#### Compare under log BRT deviance (training and testing) values

#### List of summaries of BRT models

sums = list.files('/home1/99/jc152199/brt/underlog/emptempvarsandlogvars/', recursive=T, full.names=T, pattern='maxtemp')

#### Read in all summary files to a single dataframe

### Blank object for data binding

allsum = NULL

for (s in sums)

	{
	
	### Read in a single file
	
	tt = read.csv(s,header=T)
	
	### Switch param set number
	
	p = substr(s,52,53)
	
	tt$param.set = p
	
	#### Bind to all sum
	
	allsum = rbind(allsum, tt)
	
	}
	
### Done

#### Calculate mean deviance

allsum$meandev = NA

for (i in 1:20)

	{
	
	allsum$meandev[i] = mean(c(allsum$train.deviance[i],allsum$test.deviance[i]))
	
	}
	
### Done

allsum[which(allsum$meandev==min(allsum$meandev)),]
